
var userAgentInfo = window.navigator.userAgent
var agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPod', 'iPod']

let isPC = () => {
  var flag = true
  for (var i = 0; i < agents.length; i++) {
    if (userAgentInfo.indexOf(agents[i]) > 0) {
      flag = false
      break
    }
  }
  return flag
}

let isWx = () => {
  var ua = userAgentInfo.toLowerCase()
  return ua.indexOf('micromessenger') !== -1
}

let isIOS = () => {
  return userAgentInfo.indexOf('iPhone') > 0 || userAgentInfo.indexOf('iPad') > 0
}

let isAndroid = () => {
  return userAgentInfo.indexOf('Android') > 0
}

module.exports = {
  isWx,
  isPC,
  isIOS,
  isAndroid
}
